package src.main.java.org.io;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;

/*
* FileReader
* */
public class Test7 {
    public static void main(String[] args) {
        //1.创建文件字符输入流管道连接源文件
        try (Reader fileReader = new FileReader("E:\\JavaLearn\\javaCode\\src\\test3.txt");
        ){
            //2.读取文本文件内容
             /*int c;//记住每次读取的字符编号
             while((c = fileReader.read())!=-1){
            System.out.print((char)c);
            }*/

             //每次读取多个字符
            char[] buffer =  new char[3];
            int len;
            while((len = fileReader.read(buffer))!=-1){
                System.out.println(new String(buffer, 0, len));
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
    }
}
